// run: $exec < a-small.in > a-small.out
// r > s > p
// p  r  s
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>

std::vector<int> v;
int p, r, s;
int n;
std::string str;

char calc(char x, char y)
{
	if (x == 'R') {
		if (y == 'S') return x;
		else return y;
	} else if (x == 'S') {
		if (y == 'P') return x;
		else return y;
	} else {
		if (y == 'R') return x;
		else return y;
	}
}

bool judge()
{
	std::string tmp;
	for (auto i : v) tmp += str[i];
	for (int i = 0; i < n; i++) {
		std::string t;
		for (int j = 0; j < (int)tmp.size(); j += 2) {
			if (tmp[j] == tmp[j + 1]) return false;
			t += calc(tmp[j], tmp[j + 1]);
		}
		tmp = t;
	}
	return true;
}

int main()
{
	std::ios::sync_with_stdio(false);
	int T;
	std::cin >> T;
	for (int ti = 1; ti <= T; ti++) {
		std::cout << "Case #" << ti << ": ";
		std::cin >> n >> r >> p >> s;
		v.clear();
		for (int i = 0; i < (1 << n); i++) v.push_back(i);
		str = std::string(p, 'P') + std::string(r, 'R') + std::string(s, 'S');
		bool ok = false;
		do {
			if (judge()) {
				ok = true;
				for (auto i : v) std::cout << str[i];
				std::cout << '\n';
				break;
			}
		} while (std::next_permutation(v.begin(), v.end()));
		if (!ok) {
			std::cout << "IMPOSSIBLE\n";
		}
	}
}

